    //第一版实现
    var curry1 = function(fn){
        //[].slice.call(arguments)能将具有length属性的对象转成数组
        var args = [].slice.call(arguments,1);
        console.log(args)
        return function(){
            var newArgs = args.concat([].slice.call(arguments));
            console.log(newArgs)
            return fn.apply(this,newArgs);
        }
    }

    //第二版实现
    function sub_curry(fn){
        var args = [].slice.call(arguments,1);
        return function(){
            return fn.apply(this,args.concat([].slice.call(arguments)));
        };
    }
    function curry2(fn,length){
        length = length || fn.length;
        console.log(length)
        var slice = Array.prototype.slice;
        console.log(slice)
        return function(){
            console.log(arguments);
            if(arguments.length<length){
                var combined = [fn].concat(slice.call(arguments));
                console.log('小于')
                return curry2(sub_curry.apply(this,combined),length-arguments.length);
            }else{
                console.log('大于')
                return fn.apply(this,arguments);
            }
        }
    }

    //高颜值写法
    var curry = fn => {
        judge = (...args) => {
            args.length === fn.length ? fn(...args) : (arg) => judge(...args,arg)
        }
    }

    //测试用例1
    // function add(a,b){
    //     return a+b;
    // }
    // var addCurry = curry1(add,1,2);
    // console.log(addCurry());

    //或者
    // var addCurry = curry1(add,1);
    // addCurry(2)

    //或者
    // var addCurry = curry1(add);
    // addCurry(1,2)

    //测试用例2
    var fn = curry2(function(a,b,c){
        return [a,b,c];
    });
    //fn("a", "b", "c") // ["a", "b", "c"]
    //fn("a", "b")("c") // ["a", "b", "c"]
    //console.log(fn("a")("b")("c")) // ["a", "b", "c"]
    //fn("a")("b", "c") // ["a", "b", "c"]